// @ts-ignore
/* eslint-disable */

import {
  apiRequest,
  cloudOrderRequest,
  goodsRequest,
  orderRequest,
} from '@/utils/HttpRequest';

export async function findByPageList(params?: any) {
  //SwaggerResources

  return goodsRequest.getList<API.LoginLog>('findByPageList', params);
}

export async function findByCloudPageList(params?: any) {
  //SwaggerResources

  return goodsRequest.getList<API.LoginLog>('findByCloudPageList', params);
}

export async function findByCloudOrderList(params?: any) {
  //SwaggerResources

  return cloudOrderRequest.getList<API.GoodsTaoCan>('findGoodsList', params);
}

export async function findByFindOrderList(params?: any) {
  //SwaggerResources

  return orderRequest.getList<API.GoodsTaoCan>('findGoodsList', params);
}

export async function editGoods(params: API.Goods) {
  return goodsRequest.post<any>('edit', params);
}
export async function findByBackId(id: number) {
  return goodsRequest.get<API.BaseDataResult<API.Goods>>('findByBackId', {
    id: id,
  });
}
export async function findByBackShowId(id: number) {
  return goodsRequest.get<API.Goods>('findByBackShowId', { id: id });
}
//

export async function findByGoodsBySelectList() {
  return goodsRequest.get<API.GlobalStatus>('findByBackSelectList');
}
export async function findByPageCategoryList(params?: any) {
  //SwaggerResources

  return apiRequest.getList<API.LoginLog>('category/findByPageList', params);
}

export async function editCategory(params: any) {
  return apiRequest.post<API.BaseResult>('category/edit', params);
}

export async function findByfindBySelectList() {
  return new Promise<API.GlobalStatus[]>((resolve, reject) => {
    apiRequest
      .get<API.GlobalStatus>('category/findBySelectList')
      .then((res) => {
        //   console.log("category/findBySelectList",res)
        resolve(res?.data);
      })
      .catch((e) => {
        reject(e);
      });
  });
}

//findByGoodsAngent
export async function findByGoodsAngent(id: number) {
  return goodsRequest.get<API.goodsAgentPrice>('findByGoodsAngent', { id: id });
}

//cloudChange
export async function cloudGoodsChange(params: {
  type: number;
  goodsId: number;
}) {
  return goodsRequest.getList<API.BaseResult>('cloudChange');
}
//findByPageIntegralList
export async function findByPageIntegralList(params?: any) {
  //SwaggerResources

  return goodsRequest.get<API.LoginLog>('findByPageIntegralList', params);
}
